//
//

/*
  discuss on stackoverflow:

  http://stackoverflow.com/questions/14582471/golang-memory-consumption-management
*/

package main

import (
	"fmt"
	"time"
)

func main() {
	fmt.Println("getting memory")
	tmp := make([]uint32, 100000000)
	for kk, _ := range tmp {
		tmp[kk] = 0
	}
	time.Sleep(5 * time.Second)
	fmt.Println("returning memory")
	tmp = make([]uint32, 1)
	tmp = nil
	time.Sleep(5 * time.Second)
	fmt.Println("getting memory")
	tmp = make([]uint32, 100000000)
	for kk, _ := range tmp {
		tmp[kk] = 0
	}
	time.Sleep(5 * time.Second)
	fmt.Println("returning memory")
	tmp = make([]uint32, 1)
	tmp = nil
	time.Sleep(5 * time.Second)
	return
}
